package com.jsftoolkit.gen.builder;

import com.jsftoolkit.gen.info.ChildInfo;
import com.jsftoolkit.gen.info.ComponentInfo;

/**
 * Utility for filling in a {@link ChildInfo} instance.
 * 
 * @author noah
 * 
 * @param <T>
 *            the class subclassing this class.
 */
@SuppressWarnings("unchecked")
public abstract class ChildBuilder<T extends ChildBuilder> extends
		ClassBuilder<T> {

	private final ChildInfo info;

	/**
	 * 
	 * @param info
	 *            the instance to fill in.
	 */
	public ChildBuilder(ChildInfo info) {
		super(info);
		this.info = info;
	}

	/**
	 * Specifies the class that owns this class.
	 * 
	 * @param c
	 * @return this
	 */
	public T forComponent(ComponentInfo c) {
		info.setComponent(c);
		return (T) this;
	}
}
